<%@page import="java.util.Date"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Insert title here</title>
	<style>
		body{font:12px/1.2 Verdana, sans-serif; padding:0 10px;}
		a:link, a:visited{text-decoration:none; color:#416CE5; border-bottom:1px solid #416CE5;}
		h2{font-size:13px; margin:15px 0 0 0;}
	</style>		

	<link rel="stylesheet" href="css/colorbox.css" />
	<script src="js/jquery.min.js"></script>
	<script src="js/jquery.colorbox.js"></script>
	
	<script>
		$(document).ready(function(){
			//Examples of how to assign the ColorBox event to elements
	// 		$(".group1").colorbox({rel:'group1'});
	// 		$(".group2").colorbox({rel:'group2', transition:"fade"});
	// 		$(".group3").colorbox({rel:'group3', transition:"none", width:"75%", height:"75%"});
	// 		$(".group4").colorbox({rel:'group4', slideshow:true});
	// 		$(".ajax").colorbox();
	// 		$(".youtube").colorbox({iframe:true, innerWidth:425, innerHeight:344});
			// $(".iframe").colorbox({iframe:true, width:"80%", height:"80%"});
			$("#outside").colorbox({ iframe:true, width:"60%", height:"90%",
					onOpen:function(){ 
						alert('onOpen: colorbox is about to open'); 
					},
		 			onLoad:function(){ 
		 				alert('onLoad: colorbox has started to load the targeted content'); 
 					},
		 			onComplete:function(){		 				
		 				//alert('onComplete: colorbox has displayed the loaded content');
		 				alert('TODO : resize if smaller than default size');
		 				//alert($('iframe').offset().top + $('iframe').height());
		 				
		 				//$(this).colorbox.resize();
		 				//$('.iframe').colorbox.resize();
// 		 				$.colorbox.resize( {
//  							innerHeight:($('iframe').offset().top + $('iframe').height()),
//  							innerWidth:($('iframe').offset().left + $('iframe').width())
// 						});		 				
		 				alert('resized');
 					},
		 			onCleanup:function(){ 
		 				alert('onCleanup: colorbox has begun the close process'); 
	 				},
		 			onClosed:function(){ 
		 				alert('onClosed: colorbox has completely closed'); 
		 			}
			});
	 		$(".inline").colorbox({inline:true, width:"90%", height:"90%"});
	// 		$(".callbacks").colorbox({
	// 			onOpen:function(){ alert('onOpen: colorbox is about to open'); },
	// 			onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
	// 			onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
	// 			onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
	// 			onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
	// 		});
			
			//Example of preserving a JavaScript event for inline calls.
			$("#click").click(function(){ 
				$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
				return false;
			});
		});
		
		function reload() {
			window.location.reload(true);
		}
	</script>
</head>
<body>
<!-- 	<p><a class='iframe' href="modalContent.jsp">Outside Webpage (Iframe)</a></p> -->
	<p><a id="outside" class='iframe' href="http://vietnamnet.vn/">Outside Webpage (Iframe)</a></p>
<!-- 	http://threadless.com -->
	
	<p><a class='inline' href="#inline_content">Inline HTML</a></p>	
	
	<!-- This contains the hidden content for inline calls -->
	<div style='display:none'>
		<div id='inline_content' style='padding:10px; background:#fff;'>
			<p><strong>This content comes from a hidden element on this page.</strong></p>
			<p>The inline option preserves bound JavaScript events and changes, and it puts the content back where it came from when it is closed.</p>
			<p><a id="click" href="#" style='padding:5px; background:#ccc;'>Click me, it will be preserved!</a></p>
			
			<p><strong>If you try to open a new ColorBox while it is already open, it will update itself with the new content.</strong></p>
			<p>Updating Content Example:<br />
			<a class="ajax" href="../content/flash.html">Click here to load new content</a></p>
		</div>
	</div>
	
	<p>
		<input type="button" onclick="reload()" value="reload the page" />
		<br />
		<%=new Date()%>		 
	</p>	
</body>
</html>